# @author: uuz
# encoding = utf-8

from ext import db


class Hotel(db.Model):
    __tablename__ = "hotel"
    id = db.Column(db.Integer, nullable=False, primary_key=True, autoincrement=True)
    name = db.Column(db.String(20), nullable=False, default="")
    type = db.Column(db.String(20), nullable=False, default="")
    point = db.Column(db.Float, nullable=False, default=0.0)
    fans = db.Column(db.Integer, nullable=False, default=0)
    comment_amount = db.Column(db.Integer, nullable=False, default=0)
    subtypes = db.Column(db.String(20), nullable=False, default="")
    detail = db.Column(db.String(100), nullable=False, default="")
    location = db.Column(db.String(30), nullable=False, default="")
    traffic = db.Column(db.String(30), nullable=False, default="")
    tel = db.Column(db.String(11), nullable=True)
    url = db.Column(db.Text, nullable=True)

    rooms = db.relationship("Room", foreign_keys="Room.hotel_id", backref="hotel")
    notices = db.relationship("ReservationNotice", foreign_keys="ReservationNotice.hotel_id", backref="hotel")
    qas = db.relationship("QandA", foreign_keys="QandA.hotel_id", backref="hotel")
    orders = db.relationship("Order", foreign_keys="Order.hotel_id", backref="hotel")
